{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e835af46",
   "metadata": {},
   "source": [
    "# 回顾jupyter notebook快捷键使用"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eb5573e4",
   "metadata": {},
   "source": [
    "## 命令模式"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dea86e7b",
   "metadata": {},
   "source": [
    "A:会在活跃单元之上插入一个新的单元，B:会在活跃单元之下插入一个新单元  \n",
    "连续按两次 D，可以删除一个单元   \n",
    "Z:撤销被删除的单元  \n",
    "Y:将当前活跃的单元变成一个代码单元  \n",
    "M:将一个代码单元变成markdown模式\n",
    "按住 Shift +上或下箭头可选择多个单元。在多选模式时，按住 Shift + M 可合并你的选择   \n",
    "F:会弹出「查找和替换」菜单"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ede7b035",
   "metadata": {},
   "source": [
    "## 编辑模式"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6cde5ec6",
   "metadata": {},
   "source": [
    "CTRL + enter=运行  \n",
    "Ctrl + Home=到达单元起始位置。  \n",
    "Ctrl + S=保存  \n",
    "Alt + Enter 不止会运行你的单元块，还会在下面添加一个新单元。  \n",
    "Ctrl + Shift + F 打开命令面板。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "500551bd",
   "metadata": {},
   "source": [
    "# bokeh_单图"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7d5f412c",
   "metadata": {},
   "source": [
    "## 绘图基本步骤"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "92d91d59",
   "metadata": {},
   "source": [
    "1. 从bokeh.plotting模块导入必要的函数\n",
    "2. 定义两个包含折线图数据的列表\n",
    "3. 使用该figure()功能创建您的绘图。传递以下参数: \n",
    "- title：折线图的标题（可选）\n",
    "- x_axis_label: 放置在图表 x 轴上的文本标签（可选）\n",
    "- y_axis_label: 放置在图表 y 轴上的文本标签（可选）\n",
    "4. 使用line()函数将折线图添加到您刚刚创建的绘图中。传递以下参数：\n",
    "- 您的列表x并y包含数据\n",
    "- legend_label：用于标记折线图的字符串（可选）\n",
    "- line_width: 定义线宽（以像素为单位，可选）\n",
    "5. 使用show函数生成图片"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "028123aa",
   "metadata": {},
   "source": [
    "## 单线折线图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "cb8d26fa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"https://bokeh.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"1002\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(root) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  const force = true;\n",
       "\n",
       "  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n",
       "    root._bokeh_onload_callbacks = [];\n",
       "    root._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "  const JS_MIME_TYPE = 'application/javascript';\n",
       "  const HTML_MIME_TYPE = 'text/html';\n",
       "  const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n",
       "  const CLASS_NAME = 'output_bokeh rendered_html';\n",
       "\n",
       "  /**\n",
       "   * Render data to the DOM node\n",
       "   */\n",
       "  function render(props, node) {\n",
       "    const script = document.createElement(\"script\");\n",
       "    node.appendChild(script);\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when an output is cleared or removed\n",
       "   */\n",
       "  function handleClearOutput(event, handle) {\n",
       "    const cell = handle.cell;\n",
       "\n",
       "    const id = cell.output_area._bokeh_element_id;\n",
       "    const server_id = cell.output_area._bokeh_server_id;\n",
       "    // Clean up Bokeh references\n",
       "    if (id != null && id in Bokeh.index) {\n",
       "      Bokeh.index[id].model.document.clear();\n",
       "      delete Bokeh.index[id];\n",
       "    }\n",
       "\n",
       "    if (server_id !== undefined) {\n",
       "      // Clean up Bokeh references\n",
       "      const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n",
       "      cell.notebook.kernel.execute(cmd_clean, {\n",
       "        iopub: {\n",
       "          output: function(msg) {\n",
       "            const id = msg.content.text.trim();\n",
       "            if (id in Bokeh.index) {\n",
       "              Bokeh.index[id].model.document.clear();\n",
       "              delete Bokeh.index[id];\n",
       "            }\n",
       "          }\n",
       "        }\n",
       "      });\n",
       "      // Destroy server and session\n",
       "      const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n",
       "      cell.notebook.kernel.execute(cmd_destroy);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  /**\n",
       "   * Handle when a new output is added\n",
       "   */\n",
       "  function handleAddOutput(event, handle) {\n",
       "    const output_area = handle.output_area;\n",
       "    const output = handle.output;\n",
       "\n",
       "    // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n",
       "    if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n",
       "      return\n",
       "    }\n",
       "\n",
       "    const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n",
       "\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n",
       "      toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n",
       "      // store reference to embed id on output_area\n",
       "      output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n",
       "    }\n",
       "    if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n",
       "      const bk_div = document.createElement(\"div\");\n",
       "      bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n",
       "      const script_attrs = bk_div.children[0].attributes;\n",
       "      for (let i = 0; i < script_attrs.length; i++) {\n",
       "        toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n",
       "        toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n",
       "      }\n",
       "      // store reference to server id on output_area\n",
       "      output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function register_renderer(events, OutputArea) {\n",
       "\n",
       "    function append_mime(data, metadata, element) {\n",
       "      // create a DOM node to render to\n",
       "      const toinsert = this.create_output_subarea(\n",
       "        metadata,\n",
       "        CLASS_NAME,\n",
       "        EXEC_MIME_TYPE\n",
       "      );\n",
       "      this.keyboard_manager.register_events(toinsert);\n",
       "      // Render to node\n",
       "      const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n",
       "      render(props, toinsert[toinsert.length - 1]);\n",
       "      element.append(toinsert);\n",
       "      return toinsert\n",
       "    }\n",
       "\n",
       "    /* Handle when an output is cleared or removed */\n",
       "    events.on('clear_output.CodeCell', handleClearOutput);\n",
       "    events.on('delete.Cell', handleClearOutput);\n",
       "\n",
       "    /* Handle when a new output is added */\n",
       "    events.on('output_added.OutputArea', handleAddOutput);\n",
       "\n",
       "    /**\n",
       "     * Register the mime type and append_mime function with output_area\n",
       "     */\n",
       "    OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n",
       "      /* Is output safe? */\n",
       "      safe: true,\n",
       "      /* Index of renderer in `output_area.display_order` */\n",
       "      index: 0\n",
       "    });\n",
       "  }\n",
       "\n",
       "  // register the mime type if in Jupyter Notebook environment and previously unregistered\n",
       "  if (root.Jupyter !== undefined) {\n",
       "    const events = require('base/js/events');\n",
       "    const OutputArea = require('notebook/js/outputarea').OutputArea;\n",
       "\n",
       "    if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n",
       "      register_renderer(events, OutputArea);\n",
       "    }\n",
       "  }\n",
       "\n",
       "  \n",
       "  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    root._bokeh_timeout = Date.now() + 5000;\n",
       "    root._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  const NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    const el = document.getElementById(\"1002\");\n",
       "    if (el != null) {\n",
       "      el.textContent = \"BokehJS is loading...\";\n",
       "    }\n",
       "    if (root.Bokeh !== undefined) {\n",
       "      if (el != null) {\n",
       "        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n",
       "      }\n",
       "    } else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "\n",
       "  function run_callbacks() {\n",
       "    try {\n",
       "      root._bokeh_onload_callbacks.forEach(function(callback) {\n",
       "        if (callback != null)\n",
       "          callback();\n",
       "      });\n",
       "    } finally {\n",
       "      delete root._bokeh_onload_callbacks\n",
       "    }\n",
       "    console.debug(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(css_urls, js_urls, callback) {\n",
       "    if (css_urls == null) css_urls = [];\n",
       "    if (js_urls == null) js_urls = [];\n",
       "\n",
       "    root._bokeh_onload_callbacks.push(callback);\n",
       "    if (root._bokeh_is_loading > 0) {\n",
       "      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    root._bokeh_is_loading = css_urls.length + js_urls.length;\n",
       "\n",
       "    function on_load() {\n",
       "      root._bokeh_is_loading--;\n",
       "      if (root._bokeh_is_loading === 0) {\n",
       "        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n",
       "        run_callbacks()\n",
       "      }\n",
       "    }\n",
       "\n",
       "    function on_error(url) {\n",
       "      console.error(\"failed to load \" + url);\n",
       "    }\n",
       "\n",
       "    for (let i = 0; i < css_urls.length; i++) {\n",
       "      const url = css_urls[i];\n",
       "      const element = document.createElement(\"link\");\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error.bind(null, url);\n",
       "      element.rel = \"stylesheet\";\n",
       "      element.type = \"text/css\";\n",
       "      element.href = url;\n",
       "      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n",
       "      document.body.appendChild(element);\n",
       "    }\n",
       "\n",
       "    for (let i = 0; i < js_urls.length; i++) {\n",
       "      const url = js_urls[i];\n",
       "      const element = document.createElement('script');\n",
       "      element.onload = on_load;\n",
       "      element.onerror = on_error.bind(null, url);\n",
       "      element.async = false;\n",
       "      element.src = url;\n",
       "      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.head.appendChild(element);\n",
       "    }\n",
       "  };\n",
       "\n",
       "  function inject_raw_css(css) {\n",
       "    const element = document.createElement(\"style\");\n",
       "    element.appendChild(document.createTextNode(css));\n",
       "    document.body.appendChild(element);\n",
       "  }\n",
       "\n",
       "  \n",
       "  const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.2.min.js\"];\n",
       "  const css_urls = [];\n",
       "  \n",
       "\n",
       "  const inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "    \n",
       "    \n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if (root.Bokeh !== undefined || force === true) {\n",
       "      \n",
       "    for (let i = 0; i < inline_js.length; i++) {\n",
       "      inline_js[i].call(root, root.Bokeh);\n",
       "    }\n",
       "    if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < root._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!root._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      root._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      const cell = $(document.getElementById(\"1002\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (root._bokeh_is_loading === 0) {\n",
       "    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(css_urls, js_urls, function() {\n",
       "      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(window));"
      ],
      "application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n  function now() {\n    return new Date();\n  }\n\n  const force = true;\n\n  if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n    root._bokeh_onload_callbacks = [];\n    root._bokeh_is_loading = undefined;\n  }\n\n  \n\n  \n  if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n    root._bokeh_timeout = Date.now() + 5000;\n    root._bokeh_failed_load = false;\n  }\n\n  const NB_LOAD_WARNING = {'data': {'text/html':\n     \"<div style='background-color: #fdd'>\\n\"+\n     \"<p>\\n\"+\n     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n     \"</p>\\n\"+\n     \"<ul>\\n\"+\n     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n     \"</ul>\\n\"+\n     \"<code>\\n\"+\n     \"from bokeh.resources import INLINE\\n\"+\n     \"output_notebook(resources=INLINE)\\n\"+\n     \"</code>\\n\"+\n     \"</div>\"}};\n\n  function display_loaded() {\n    const el = document.getElementById(\"1002\");\n    if (el != null) {\n      el.textContent = \"BokehJS is loading...\";\n    }\n    if (root.Bokeh !== undefined) {\n      if (el != null) {\n        el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n      }\n    } else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(display_loaded, 100)\n    }\n  }\n\n\n  function run_callbacks() {\n    try {\n      root._bokeh_onload_callbacks.forEach(function(callback) {\n        if (callback != null)\n          callback();\n      });\n    } finally {\n      delete root._bokeh_onload_callbacks\n    }\n    console.debug(\"Bokeh: all callbacks have finished\");\n  }\n\n  function load_libs(css_urls, js_urls, callback) {\n    if (css_urls == null) css_urls = [];\n    if (js_urls == null) js_urls = [];\n\n    root._bokeh_onload_callbacks.push(callback);\n    if (root._bokeh_is_loading > 0) {\n      console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n      return null;\n    }\n    if (js_urls == null || js_urls.length === 0) {\n      run_callbacks();\n      return null;\n    }\n    console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n    root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n    function on_load() {\n      root._bokeh_is_loading--;\n      if (root._bokeh_is_loading === 0) {\n        console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n        run_callbacks()\n      }\n    }\n\n    function on_error(url) {\n      console.error(\"failed to load \" + url);\n    }\n\n    for (let i = 0; i < css_urls.length; i++) {\n      const url = css_urls[i];\n      const element = document.createElement(\"link\");\n      element.onload = on_load;\n      element.onerror = on_error.bind(null, url);\n      element.rel = \"stylesheet\";\n      element.type = \"text/css\";\n      element.href = url;\n      console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n      document.body.appendChild(element);\n    }\n\n    for (let i = 0; i < js_urls.length; i++) {\n      const url = js_urls[i];\n      const element = document.createElement('script');\n      element.onload = on_load;\n      element.onerror = on_error.bind(null, url);\n      element.async = false;\n      element.src = url;\n      console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n      document.head.appendChild(element);\n    }\n  };\n\n  function inject_raw_css(css) {\n    const element = document.createElement(\"style\");\n    element.appendChild(document.createTextNode(css));\n    document.body.appendChild(element);\n  }\n\n  \n  const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.2.min.js\"];\n  const css_urls = [];\n  \n\n  const inline_js = [\n    function(Bokeh) {\n      Bokeh.set_log_level(\"info\");\n    },\n    function(Bokeh) {\n    \n    \n    }\n  ];\n\n  function run_inline_js() {\n    \n    if (root.Bokeh !== undefined || force === true) {\n      \n    for (let i = 0; i < inline_js.length; i++) {\n      inline_js[i].call(root, root.Bokeh);\n    }\n    if (force === true) {\n        display_loaded();\n      }} else if (Date.now() < root._bokeh_timeout) {\n      setTimeout(run_inline_js, 100);\n    } else if (!root._bokeh_failed_load) {\n      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n      root._bokeh_failed_load = true;\n    } else if (force !== true) {\n      const cell = $(document.getElementById(\"1002\")).parents('.cell').data().cell;\n      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n    }\n\n  }\n\n  if (root._bokeh_is_loading === 0) {\n    console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n    run_inline_js();\n  } else {\n    load_libs(css_urls, js_urls, function() {\n      console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n      run_inline_js();\n    });\n  }\n}(window));"
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"3584ea43-48cd-426f-b868-53d4fa016717\" data-root-id=\"1003\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"863d834f-9f39-4bb0-b7d2-ed81f78c6bd0\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1014\"}],\"center\":[{\"id\":\"1017\"},{\"id\":\"1021\"},{\"id\":\"1052\"}],\"left\":[{\"id\":\"1018\"}],\"renderers\":[{\"id\":\"1040\"}],\"title\":{\"id\":\"1004\"},\"toolbar\":{\"id\":\"1029\"},\"x_range\":{\"id\":\"1006\"},\"x_scale\":{\"id\":\"1010\"},\"y_range\":{\"id\":\"1008\"},\"y_scale\":{\"id\":\"1012\"}},\"id\":\"1003\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1012\",\"type\":\"LinearScale\"},{\"attributes\":{\"label\":{\"value\":\"Temp.\"},\"renderers\":[{\"id\":\"1040\"}]},\"id\":\"1053\",\"type\":\"LegendItem\"},{\"attributes\":{\"axis_label\":\"y\",\"coordinates\":null,\"formatter\":{\"id\":\"1044\"},\"group\":null,\"major_label_policy\":{\"id\":\"1045\"},\"ticker\":{\"id\":\"1019\"}},\"id\":\"1018\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1027\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1015\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1047\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1006\",\"type\":\"DataRange1d\"},{\"attributes\":{\"axis\":{\"id\":\"1014\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1017\",\"type\":\"Grid\"},{\"attributes\":{\"tools\":[{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"},{\"id\":\"1026\"},{\"id\":\"1027\"}]},\"id\":\"1029\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1019\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1028\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1036\"},\"glyph\":{\"id\":\"1037\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1039\"},\"nonselection_glyph\":{\"id\":\"1038\"},\"view\":{\"id\":\"1041\"}},\"id\":\"1040\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1010\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1008\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1048\",\"type\":\"AllLabels\"},{\"attributes\":{\"axis_label\":\"x\",\"coordinates\":null,\"formatter\":{\"id\":\"1047\"},\"group\":null,\"major_label_policy\":{\"id\":\"1048\"},\"ticker\":{\"id\":\"1015\"}},\"id\":\"1014\",\"type\":\"LinearAxis\"},{\"attributes\":{\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1037\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1039\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1044\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1050\",\"type\":\"Selection\"},{\"attributes\":{\"source\":{\"id\":\"1036\"}},\"id\":\"1041\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1022\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1045\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"#1f77b4\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1038\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1026\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1023\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1028\"}},\"id\":\"1024\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Simple line example\"},\"id\":\"1004\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1049\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"SaveTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"1053\"}]},\"id\":\"1052\",\"type\":\"Legend\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]},\"selected\":{\"id\":\"1050\"},\"selection_policy\":{\"id\":\"1049\"}},\"id\":\"1036\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"axis\":{\"id\":\"1018\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1021\",\"type\":\"Grid\"}],\"root_ids\":[\"1003\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"863d834f-9f39-4bb0-b7d2-ed81f78c6bd0\",\"root_ids\":[\"1003\"],\"roots\":{\"1003\":\"3584ea43-48cd-426f-b868-53d4fa016717\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1003"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure, show, output_notebook\n",
    "# 在notebook中显示\n",
    "output_notebook() \n",
    "# 准备相关数据 prepare some data\n",
    "x = [1, 2, 3, 4, 5]\n",
    "y = [6, 7, 2, 4, 5]\n",
    "# 创建一个带有标题和轴标签的新图片 create a new plot with a title and axis labels\n",
    "p = figure(title=\"Simple line example\", x_axis_label='x', y_axis_label='y')\n",
    "# 添加一个带有图例和线条粗细的线条渲染器 add a line renderer with legend and line thickness to the plot\n",
    "p.line(x, y, legend_label=\"Temp.\", line_width=2)\n",
    "# 结果展示 show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "266962dd",
   "metadata": {},
   "source": [
    "## 多线折线图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3b57d14c",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"0bfe14c8-c906-487d-b08d-8b7c95ba3151\" data-root-id=\"1114\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"33d349b6-2c49-4e45-b2ec-211b9d19fa17\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1125\"}],\"center\":[{\"id\":\"1128\"},{\"id\":\"1132\"},{\"id\":\"1163\"}],\"left\":[{\"id\":\"1129\"}],\"renderers\":[{\"id\":\"1151\"},{\"id\":\"1169\"},{\"id\":\"1188\"}],\"title\":{\"id\":\"1115\"},\"toolbar\":{\"id\":\"1140\"},\"x_range\":{\"id\":\"1117\"},\"x_scale\":{\"id\":\"1121\"},\"y_range\":{\"id\":\"1119\"},\"y_scale\":{\"id\":\"1123\"}},\"id\":\"1114\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1159\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1167\",\"type\":\"Line\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"1164\"},{\"id\":\"1183\"},{\"id\":\"1204\"}]},\"id\":\"1163\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1130\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1161\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1158\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"label\":{\"value\":\"Rate\"},\"renderers\":[{\"id\":\"1169\"}]},\"id\":\"1183\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1180\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1181\",\"type\":\"Selection\"},{\"attributes\":{\"tools\":[{\"id\":\"1133\"},{\"id\":\"1134\"},{\"id\":\"1135\"},{\"id\":\"1136\"},{\"id\":\"1137\"},{\"id\":\"1138\"}]},\"id\":\"1140\",\"type\":\"Toolbar\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[2,3,4,5,6]},\"selected\":{\"id\":\"1181\"},\"selection_policy\":{\"id\":\"1180\"}},\"id\":\"1165\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"line_color\":\"blue\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1148\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"green\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1186\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1160\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"blue\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1149\",\"type\":\"Line\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"blue\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1150\",\"type\":\"Line\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]},\"selected\":{\"id\":\"1161\"},\"selection_policy\":{\"id\":\"1160\"}},\"id\":\"1147\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1139\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1147\"},\"glyph\":{\"id\":\"1148\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1150\"},\"nonselection_glyph\":{\"id\":\"1149\"},\"view\":{\"id\":\"1152\"}},\"id\":\"1151\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1184\"}},\"id\":\"1189\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1156\",\"type\":\"AllLabels\"},{\"attributes\":{\"axis\":{\"id\":\"1125\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1128\",\"type\":\"Grid\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"green\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1187\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1133\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1117\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1137\",\"type\":\"ResetTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Multiple line example\"},\"id\":\"1115\",\"type\":\"Title\"},{\"attributes\":{\"line_color\":\"green\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1185\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1134\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"source\":{\"id\":\"1147\"}},\"id\":\"1152\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"1139\"}},\"id\":\"1135\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1119\",\"type\":\"DataRange1d\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1184\"},\"glyph\":{\"id\":\"1185\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1187\"},\"nonselection_glyph\":{\"id\":\"1186\"},\"view\":{\"id\":\"1189\"}},\"id\":\"1188\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis\":{\"id\":\"1129\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1132\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1136\",\"type\":\"SaveTool\"},{\"attributes\":{\"label\":{\"value\":\"Temp.\"},\"renderers\":[{\"id\":\"1151\"}]},\"id\":\"1164\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1168\",\"type\":\"Line\"},{\"attributes\":{\"axis_label\":\"x\",\"coordinates\":null,\"formatter\":{\"id\":\"1158\"},\"group\":null,\"major_label_policy\":{\"id\":\"1159\"},\"ticker\":{\"id\":\"1126\"}},\"id\":\"1125\",\"type\":\"LinearAxis\"},{\"attributes\":{\"source\":{\"id\":\"1165\"}},\"id\":\"1170\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1138\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1121\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_color\":\"red\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1166\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1202\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1123\",\"type\":\"LinearScale\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1165\"},\"glyph\":{\"id\":\"1166\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1168\"},\"nonselection_glyph\":{\"id\":\"1167\"},\"view\":{\"id\":\"1170\"}},\"id\":\"1169\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"y\",\"coordinates\":null,\"formatter\":{\"id\":\"1155\"},\"group\":null,\"major_label_policy\":{\"id\":\"1156\"},\"ticker\":{\"id\":\"1130\"}},\"id\":\"1129\",\"type\":\"LinearAxis\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[4,5,5,7,2]},\"selected\":{\"id\":\"1202\"},\"selection_policy\":{\"id\":\"1201\"}},\"id\":\"1184\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1155\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1201\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1126\",\"type\":\"BasicTicker\"},{\"attributes\":{\"label\":{\"value\":\"Objects\"},\"renderers\":[{\"id\":\"1188\"}]},\"id\":\"1204\",\"type\":\"LegendItem\"}],\"root_ids\":[\"1114\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"33d349b6-2c49-4e45-b2ec-211b9d19fa17\",\"root_ids\":[\"1114\"],\"roots\":{\"1114\":\"0bfe14c8-c906-487d-b08d-8b7c95ba3151\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1114"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure, show\n",
    "\n",
    "# 添加更多数据 prepare some data\n",
    "x = [1, 2, 3, 4, 5]\n",
    "y1 = [6, 7, 2, 4, 5]\n",
    "y2 = [2, 3, 4, 5, 6]\n",
    "y3 = [4, 5, 5, 7, 2]\n",
    "\n",
    "# 更改title以更新绘图标题 create a new plot with a title and axis labels\n",
    "p = figure(title=\"Multiple line example\", x_axis_label=\"x\", y_axis_label=\"y\")\n",
    "\n",
    "# 添加更多渲染add multiple renderers\n",
    "p.line(x, y1, legend_label=\"Temp.\", color=\"blue\", line_width=2)\n",
    "p.line(x, y2, legend_label=\"Rate\", color=\"red\", line_width=2)\n",
    "p.line(x, y3, legend_label=\"Objects\", color=\"green\", line_width=2)\n",
    "\n",
    "# show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e14c8c68",
   "metadata": {},
   "source": [
    "## 自定义渲染条renderers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "96cc740d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"82697a30-3553-4f00-8066-e734b234f696\" data-root-id=\"1299\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"036ccb92-c6f0-4fed-907c-ba7f0d9e5339\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1310\"}],\"center\":[{\"id\":\"1313\"},{\"id\":\"1317\"},{\"id\":\"1348\"}],\"left\":[{\"id\":\"1314\"}],\"renderers\":[{\"id\":\"1336\"},{\"id\":\"1354\"},{\"id\":\"1373\"}],\"title\":{\"id\":\"1300\"},\"toolbar\":{\"id\":\"1325\"},\"x_range\":{\"id\":\"1302\"},\"x_scale\":{\"id\":\"1306\"},\"y_range\":{\"id\":\"1304\"},\"y_scale\":{\"id\":\"1308\"}},\"id\":\"1299\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"yellow\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"yellow\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"yellow\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1372\",\"type\":\"Circle\"},{\"attributes\":{\"axis\":{\"id\":\"1310\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1313\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"firebrick\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"firebrick\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"firebrick\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.5},\"x\":{\"field\":\"x\"}},\"id\":\"1352\",\"type\":\"VBar\"},{\"attributes\":{\"source\":{\"id\":\"1369\"}},\"id\":\"1374\",\"type\":\"CDSView\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"blue\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1334\",\"type\":\"Line\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"firebrick\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"firebrick\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"firebrick\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.5},\"x\":{\"field\":\"x\"}},\"id\":\"1353\",\"type\":\"VBar\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1350\"},\"glyph\":{\"id\":\"1351\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1353\"},\"nonselection_glyph\":{\"id\":\"1352\"},\"view\":{\"id\":\"1355\"}},\"id\":\"1354\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis\":{\"id\":\"1314\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1317\",\"type\":\"Grid\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[6,7,2,4,5]},\"selected\":{\"id\":\"1346\"},\"selection_policy\":{\"id\":\"1345\"}},\"id\":\"1332\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"1350\"}},\"id\":\"1355\",\"type\":\"CDSView\"},{\"attributes\":{\"axis_label\":\"y\",\"coordinates\":null,\"formatter\":{\"id\":\"1340\"},\"group\":null,\"major_label_policy\":{\"id\":\"1341\"},\"ticker\":{\"id\":\"1315\"}},\"id\":\"1314\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1315\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1387\",\"type\":\"Selection\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1324\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"label\":{\"value\":\"Rate\"},\"renderers\":[{\"id\":\"1354\"}]},\"id\":\"1368\",\"type\":\"LegendItem\"},{\"attributes\":{\"label\":{\"value\":\"Objects\"},\"renderers\":[{\"id\":\"1373\"}]},\"id\":\"1389\",\"type\":\"LegendItem\"},{\"attributes\":{\"tools\":[{\"id\":\"1318\"},{\"id\":\"1319\"},{\"id\":\"1320\"},{\"id\":\"1321\"},{\"id\":\"1322\"},{\"id\":\"1323\"}]},\"id\":\"1325\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1365\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1366\",\"type\":\"Selection\"},{\"attributes\":{\"data\":{\"top\":[2,3,4,5,6],\"x\":[1,2,3,4,5]},\"selected\":{\"id\":\"1366\"},\"selection_policy\":{\"id\":\"1365\"}},\"id\":\"1350\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1345\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1344\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1341\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1386\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"1349\"},{\"id\":\"1368\"},{\"id\":\"1389\"}]},\"id\":\"1348\",\"type\":\"Legend\"},{\"attributes\":{},\"id\":\"1311\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1343\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1302\",\"type\":\"DataRange1d\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Multiple glyphs example\"},\"id\":\"1300\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1318\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1322\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1304\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_color\":{\"value\":\"yellow\"},\"hatch_color\":{\"value\":\"yellow\"},\"line_color\":{\"value\":\"yellow\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1370\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1319\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"label\":{\"value\":\"Temp.\"},\"renderers\":[{\"id\":\"1336\"}]},\"id\":\"1349\",\"type\":\"LegendItem\"},{\"attributes\":{\"line_color\":\"blue\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1333\",\"type\":\"Line\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"yellow\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"yellow\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"yellow\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1371\",\"type\":\"Circle\"},{\"attributes\":{\"overlay\":{\"id\":\"1324\"}},\"id\":\"1320\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[4,5,5,7,2]},\"selected\":{\"id\":\"1387\"},\"selection_policy\":{\"id\":\"1386\"}},\"id\":\"1369\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1308\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1321\",\"type\":\"SaveTool\"},{\"attributes\":{\"axis_label\":\"x\",\"coordinates\":null,\"formatter\":{\"id\":\"1343\"},\"group\":null,\"major_label_policy\":{\"id\":\"1344\"},\"ticker\":{\"id\":\"1311\"}},\"id\":\"1310\",\"type\":\"LinearAxis\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1369\"},\"glyph\":{\"id\":\"1370\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1372\"},\"nonselection_glyph\":{\"id\":\"1371\"},\"view\":{\"id\":\"1374\"}},\"id\":\"1373\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"blue\",\"line_width\":2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1335\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1346\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1306\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_color\":{\"value\":\"firebrick\"},\"hatch_color\":{\"value\":\"firebrick\"},\"line_color\":{\"value\":\"firebrick\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.5},\"x\":{\"field\":\"x\"}},\"id\":\"1351\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"1323\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1340\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1332\"},\"glyph\":{\"id\":\"1333\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1335\"},\"nonselection_glyph\":{\"id\":\"1334\"},\"view\":{\"id\":\"1337\"}},\"id\":\"1336\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"source\":{\"id\":\"1332\"}},\"id\":\"1337\",\"type\":\"CDSView\"}],\"root_ids\":[\"1299\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"036ccb92-c6f0-4fed-907c-ba7f0d9e5339\",\"root_ids\":[\"1299\"],\"roots\":{\"1299\":\"82697a30-3553-4f00-8066-e734b234f696\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1299"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure, show\n",
    "\n",
    "# prepare some data\n",
    "x = [1, 2, 3, 4, 5]\n",
    "y1 = [6, 7, 2, 4, 5]\n",
    "y2 = [2, 3, 4, 5, 6]\n",
    "y3 = [4, 5, 5, 7, 2]\n",
    "\n",
    "# create a new plot with a title and axis labels\n",
    "p = figure(title=\"Multiple glyphs example\", x_axis_label=\"x\", y_axis_label=\"y\")\n",
    "\n",
    "# 使用circle() vbar() line() add multiple renderers\n",
    "p.line(x, y1, legend_label=\"Temp.\", color=\"blue\", line_width=2)\n",
    "p.vbar(x=x, top=y2, legend_label=\"Rate\", width=0.5, bottom=0, color=\"firebrick\")\n",
    "p.circle(x, y3, legend_label=\"Objects\", color=\"yellow\", size=12)\n",
    "\n",
    "# show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3147f641",
   "metadata": {},
   "source": [
    "## 自定义渲染器颜色 circle为例"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e7af12fe",
   "metadata": {},
   "source": [
    "- 颜色有多种指定方式\n",
    "- fill_color: 圆圈的填充颜色\n",
    "- fill_alpha：填充颜色的透明度（和之间的任何0 值1）\n",
    "- line_color: 圆圈轮廓的填充颜色\n",
    "- size：圆圈的大小（以屏幕单位或数据单位）\n",
    "- legend_label：圈子的图例条目"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1b9d1bd8",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"679037ee-e446-491b-9bec-8f0e62c15594\" data-root-id=\"1498\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"398c2a50-314e-47de-abb7-052e0619e048\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1509\"}],\"center\":[{\"id\":\"1512\"},{\"id\":\"1516\"},{\"id\":\"1547\"}],\"left\":[{\"id\":\"1513\"}],\"renderers\":[{\"id\":\"1535\"}],\"title\":{\"id\":\"1499\"},\"toolbar\":{\"id\":\"1524\"},\"x_range\":{\"id\":\"1501\"},\"x_scale\":{\"id\":\"1505\"},\"y_range\":{\"id\":\"1503\"},\"y_scale\":{\"id\":\"1507\"}},\"id\":\"1498\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"tools\":[{\"id\":\"1517\"},{\"id\":\"1518\"},{\"id\":\"1519\"},{\"id\":\"1520\"},{\"id\":\"1521\"},{\"id\":\"1522\"}]},\"id\":\"1524\",\"type\":\"Toolbar\"},{\"attributes\":{\"axis_label\":\"y\",\"coordinates\":null,\"formatter\":{\"id\":\"1539\"},\"group\":null,\"major_label_policy\":{\"id\":\"1540\"},\"ticker\":{\"id\":\"1514\"}},\"id\":\"1513\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1514\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1523\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1531\"},\"glyph\":{\"id\":\"1532\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1534\"},\"nonselection_glyph\":{\"id\":\"1533\"},\"view\":{\"id\":\"1536\"}},\"id\":\"1535\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"items\":[{\"id\":\"1548\"}]},\"id\":\"1547\",\"type\":\"Legend\"},{\"attributes\":{\"source\":{\"id\":\"1531\"}},\"id\":\"1536\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"red\"},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"blue\"},\"size\":{\"value\":80},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1533\",\"type\":\"Circle\"},{\"attributes\":{\"label\":{\"value\":\"Objects\"},\"renderers\":[{\"id\":\"1535\"}]},\"id\":\"1548\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"1545\",\"type\":\"Selection\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[4,5,5,7,2]},\"selected\":{\"id\":\"1545\"},\"selection_policy\":{\"id\":\"1544\"}},\"id\":\"1531\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"red\"},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"blue\"},\"size\":{\"value\":80},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1534\",\"type\":\"Circle\"},{\"attributes\":{\"axis\":{\"id\":\"1509\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1512\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1544\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1501\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1517\",\"type\":\"PanTool\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Glyphs properties example\"},\"id\":\"1499\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1521\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1518\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1503\",\"type\":\"DataRange1d\"},{\"attributes\":{\"overlay\":{\"id\":\"1523\"}},\"id\":\"1519\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1520\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1539\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis_label\":\"x\",\"coordinates\":null,\"formatter\":{\"id\":\"1542\"},\"group\":null,\"major_label_policy\":{\"id\":\"1543\"},\"ticker\":{\"id\":\"1510\"}},\"id\":\"1509\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1542\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1505\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1522\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1540\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1543\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1507\",\"type\":\"LinearScale\"},{\"attributes\":{\"axis\":{\"id\":\"1513\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1516\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1510\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"blue\"},\"line_color\":{\"value\":\"blue\"},\"size\":{\"value\":80},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1532\",\"type\":\"Circle\"}],\"root_ids\":[\"1498\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"398c2a50-314e-47de-abb7-052e0619e048\",\"root_ids\":[\"1498\"],\"roots\":{\"1498\":\"679037ee-e446-491b-9bec-8f0e62c15594\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1498"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from bokeh.plotting import figure, show\n",
    "\n",
    "# prepare some data\n",
    "x = [1, 2, 3, 4, 5]\n",
    "y = [4, 5, 5, 7, 2]\n",
    "\n",
    "# create a new plot with a title and axis labels\n",
    "p = figure(title=\"Glyphs properties example\", x_axis_label=\"x\", y_axis_label=\"y\")\n",
    "\n",
    "# add circle renderer with additional arguments\n",
    "circle = p.circle(\n",
    "    x,\n",
    "    y,\n",
    "    legend_label=\"Objects\",\n",
    "    fill_color=\"red\",\n",
    "    fill_alpha=0.5,\n",
    "    line_color=\"blue\",\n",
    "    size=80,\n",
    ")\n",
    "\n",
    "#在原有基础上改变颜色 change color of previously created object's glyph\n",
    "glyph = circle.glyph\n",
    "glyph.fill_color = \"blue\"\n",
    "\n",
    "# show the results\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "18d6d541",
   "metadata": {},
   "source": [
    "## 自定义情节"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86ff4d3d",
   "metadata": {},
   "source": [
    "- [注释、标题详见](https://docs.bokeh.org/en/latest/docs/first_steps/first_steps_3.html)   \n",
    "- [主题、绘图宽高、响应式绘图、轴的外观等等](https://docs.bokeh.org/en/latest/docs/first_steps/first_steps_4.html)\n",
    "- [矢量化数据颜色](https://docs.bokeh.org/en/latest/docs/first_steps/first_steps_5.html)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f23ae40b",
   "metadata": {},
   "source": [
    "# bokeh_组合图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "15fdbcb8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"5f0dc96e-c4a8-499a-8775-1ad8bfae6914\" data-root-id=\"1758\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"560e25ce-2e75-433e-9f75-cc3ccbb94a6a\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"children\":[{\"id\":\"1647\"},{\"id\":\"1684\"},{\"id\":\"1721\"}]},\"id\":\"1758\",\"type\":\"Row\"},{\"attributes\":{},\"id\":\"1817\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data\":{\"x\":[0,1,2,3,4,5,6,7,8,9,10],\"y\":[5,4,3,2,1,0,1,2,3,4,5]},\"selected\":{\"id\":\"1838\"},\"selection_policy\":{\"id\":\"1837\"}},\"id\":\"1752\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1818\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1701\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1815\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1705\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1702\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1821\",\"type\":\"AllLabels\"},{\"attributes\":{\"overlay\":{\"id\":\"1707\"}},\"id\":\"1703\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1704\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"1823\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1820\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#c02942\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#c02942\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#c02942\"},\"marker\":{\"value\":\"triangle\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1718\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1706\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"1824\",\"type\":\"AllLabels\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#d95b43\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#d95b43\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#d95b43\"},\"marker\":{\"value\":\"square\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1755\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1738\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1827\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1742\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"1739\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"overlay\":{\"id\":\"1744\"}},\"id\":\"1740\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1829\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1826\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"1741\",\"type\":\"SaveTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1752\"},\"glyph\":{\"id\":\"1753\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1755\"},\"nonselection_glyph\":{\"id\":\"1754\"},\"view\":{\"id\":\"1757\"}},\"id\":\"1756\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1830\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1831\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"1743\",\"type\":\"HelpTool\"},{\"attributes\":{\"tools\":[{\"id\":\"1664\"},{\"id\":\"1665\"},{\"id\":\"1666\"},{\"id\":\"1667\"},{\"id\":\"1668\"},{\"id\":\"1669\"}]},\"id\":\"1671\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1832\",\"type\":\"Selection\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1707\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"tools\":[{\"id\":\"1701\"},{\"id\":\"1702\"},{\"id\":\"1703\"},{\"id\":\"1704\"},{\"id\":\"1705\"},{\"id\":\"1706\"}]},\"id\":\"1708\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1834\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1715\"},\"glyph\":{\"id\":\"1716\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1718\"},\"nonselection_glyph\":{\"id\":\"1717\"},\"view\":{\"id\":\"1720\"}},\"id\":\"1719\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1835\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1837\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"1752\"}},\"id\":\"1757\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1838\",\"type\":\"Selection\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#d95b43\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#d95b43\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#d95b43\"},\"marker\":{\"value\":\"square\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1754\",\"type\":\"Scatter\"},{\"attributes\":{\"data\":{\"x\":[0,1,2,3,4,5,6,7,8,9,10],\"y\":[0,1,2,3,4,5,6,7,8,9,10]},\"selected\":{\"id\":\"1832\"},\"selection_policy\":{\"id\":\"1831\"}},\"id\":\"1678\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"source\":{\"id\":\"1715\"}},\"id\":\"1720\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#d95b43\"},\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#d95b43\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"#d95b43\"},\"marker\":{\"value\":\"square\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1753\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1648\",\"type\":\"DataRange1d\"},{\"attributes\":{\"background_fill_color\":\"#fafafa\",\"below\":[{\"id\":\"1656\"}],\"center\":[{\"id\":\"1659\"},{\"id\":\"1663\"}],\"height\":250,\"left\":[{\"id\":\"1660\"}],\"renderers\":[{\"id\":\"1682\"}],\"title\":{\"id\":\"1807\"},\"toolbar\":{\"id\":\"1671\"},\"width\":250,\"x_range\":{\"id\":\"1648\"},\"x_scale\":{\"id\":\"1652\"},\"y_range\":{\"id\":\"1650\"},\"y_scale\":{\"id\":\"1654\"}},\"id\":\"1647\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1650\",\"type\":\"DataRange1d\"},{\"attributes\":{\"overlay\":{\"id\":\"1670\"}},\"id\":\"1666\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1744\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"1722\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1724\",\"type\":\"DataRange1d\"},{\"attributes\":{\"background_fill_color\":\"#fafafa\",\"below\":[{\"id\":\"1693\"}],\"center\":[{\"id\":\"1696\"},{\"id\":\"1700\"}],\"height\":250,\"left\":[{\"id\":\"1697\"}],\"renderers\":[{\"id\":\"1719\"}],\"title\":{\"id\":\"1809\"},\"toolbar\":{\"id\":\"1708\"},\"width\":250,\"x_range\":{\"id\":\"1685\"},\"x_scale\":{\"id\":\"1689\"},\"y_range\":{\"id\":\"1687\"},\"y_scale\":{\"id\":\"1691\"}},\"id\":\"1684\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"1811\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1731\",\"type\":\"BasicTicker\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"1807\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1657\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1726\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1652\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1728\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1654\",\"type\":\"LinearScale\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"1829\"},\"group\":null,\"major_label_policy\":{\"id\":\"1830\"},\"ticker\":{\"id\":\"1731\"}},\"id\":\"1730\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1661\",\"type\":\"BasicTicker\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"1817\"},\"group\":null,\"major_label_policy\":{\"id\":\"1818\"},\"ticker\":{\"id\":\"1657\"}},\"id\":\"1656\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis\":{\"id\":\"1730\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1733\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1814\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"axis\":{\"id\":\"1656\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1659\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1735\",\"type\":\"BasicTicker\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"1826\"},\"group\":null,\"major_label_policy\":{\"id\":\"1827\"},\"ticker\":{\"id\":\"1735\"}},\"id\":\"1734\",\"type\":\"LinearAxis\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"1809\",\"type\":\"Title\"},{\"attributes\":{\"axis\":{\"id\":\"1734\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1737\",\"type\":\"Grid\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"1814\"},\"group\":null,\"major_label_policy\":{\"id\":\"1815\"},\"ticker\":{\"id\":\"1661\"}},\"id\":\"1660\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis\":{\"id\":\"1660\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1663\",\"type\":\"Grid\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#53777a\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#53777a\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#53777a\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1680\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1664\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1665\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1678\"},\"glyph\":{\"id\":\"1679\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1681\"},\"nonselection_glyph\":{\"id\":\"1680\"},\"view\":{\"id\":\"1683\"}},\"id\":\"1682\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#53777a\"},\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#53777a\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"#53777a\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1679\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"1667\",\"type\":\"SaveTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#53777a\"},\"hatch_alpha\":{\"value\":0.2},\"hatch_color\":{\"value\":\"#53777a\"},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#53777a\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1681\",\"type\":\"Circle\"},{\"attributes\":{\"source\":{\"id\":\"1678\"}},\"id\":\"1683\",\"type\":\"CDSView\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#c02942\"},\"hatch_alpha\":{\"value\":0.1},\"hatch_color\":{\"value\":\"#c02942\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#c02942\"},\"marker\":{\"value\":\"triangle\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1717\",\"type\":\"Scatter\"},{\"attributes\":{},\"id\":\"1685\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1687\",\"type\":\"DataRange1d\"},{\"attributes\":{\"tools\":[{\"id\":\"1738\"},{\"id\":\"1739\"},{\"id\":\"1740\"},{\"id\":\"1741\"},{\"id\":\"1742\"},{\"id\":\"1743\"}]},\"id\":\"1745\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"1694\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1689\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1691\",\"type\":\"LinearScale\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1670\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"1823\"},\"group\":null,\"major_label_policy\":{\"id\":\"1824\"},\"ticker\":{\"id\":\"1694\"}},\"id\":\"1693\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis\":{\"id\":\"1693\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1696\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1698\",\"type\":\"BasicTicker\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"1820\"},\"group\":null,\"major_label_policy\":{\"id\":\"1821\"},\"ticker\":{\"id\":\"1698\"}},\"id\":\"1697\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1668\",\"type\":\"ResetTool\"},{\"attributes\":{\"axis\":{\"id\":\"1697\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1700\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1669\",\"type\":\"HelpTool\"},{\"attributes\":{\"data\":{\"x\":[0,1,2,3,4,5,6,7,8,9,10],\"y\":[10,9,8,7,6,5,4,3,2,1,0]},\"selected\":{\"id\":\"1835\"},\"selection_policy\":{\"id\":\"1834\"}},\"id\":\"1715\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.8},\"fill_color\":{\"value\":\"#c02942\"},\"hatch_alpha\":{\"value\":0.8},\"hatch_color\":{\"value\":\"#c02942\"},\"line_alpha\":{\"value\":0.8},\"line_color\":{\"value\":\"#c02942\"},\"marker\":{\"value\":\"triangle\"},\"size\":{\"value\":12},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1716\",\"type\":\"Scatter\"},{\"attributes\":{\"background_fill_color\":\"#fafafa\",\"below\":[{\"id\":\"1730\"}],\"center\":[{\"id\":\"1733\"},{\"id\":\"1737\"}],\"height\":250,\"left\":[{\"id\":\"1734\"}],\"renderers\":[{\"id\":\"1756\"}],\"title\":{\"id\":\"1811\"},\"toolbar\":{\"id\":\"1745\"},\"width\":250,\"x_range\":{\"id\":\"1722\"},\"x_scale\":{\"id\":\"1726\"},\"y_range\":{\"id\":\"1724\"},\"y_scale\":{\"id\":\"1728\"}},\"id\":\"1721\",\"subtype\":\"Figure\",\"type\":\"Plot\"}],\"root_ids\":[\"1758\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"560e25ce-2e75-433e-9f75-cc3ccbb94a6a\",\"root_ids\":[\"1758\"],\"roots\":{\"1758\":\"5f0dc96e-c4a8-499a-8775-1ad8bfae6914\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "1758"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 将多个绘图组合成水平行布局，您首先需要导入 row. 然后row()在调用时使用该函数 show()：\n",
    "# 要在垂直列布局中显示多个图用column()函数。更灵活的方法是使用gridplot()函数。\n",
    "from bokeh.layouts import row\n",
    "from bokeh.plotting import figure, show\n",
    "\n",
    "# prepare some data\n",
    "x = list(range(11))\n",
    "y0 = x\n",
    "y1 = [10 - i for i in x]\n",
    "y2 = [abs(i - 5) for i in x]\n",
    "\n",
    "# create three plots with one renderer each\n",
    "s1 = figure(width=250, height=250, background_fill_color=\"#fafafa\")\n",
    "s1.circle(x, y0, size=12, color=\"#53777a\", alpha=0.8)\n",
    "\n",
    "s2 = figure(width=250, height=250, background_fill_color=\"#fafafa\")\n",
    "s2.triangle(x, y1, size=12, color=\"#c02942\", alpha=0.8)\n",
    "\n",
    "s3 = figure(width=250, height=250, background_fill_color=\"#fafafa\")\n",
    "s3.square(x, y2, size=12, color=\"#d95b43\", alpha=0.8)\n",
    "\n",
    "# put the results in a row and show\n",
    "show(row(s1, s2, s3))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6eebc136",
   "metadata": {},
   "source": [
    "# 导入和过滤数据"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6030bc14",
   "metadata": {},
   "source": [
    "## 导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "9593c331",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"0aa634eb-d56e-4124-bc18-b5b749f1e1f0\" data-root-id=\"2006\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"9ca61b38-f2f2-420c-bf77-6d13ed7f9174\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"2015\"}],\"center\":[{\"id\":\"2018\"},{\"id\":\"2022\"}],\"left\":[{\"id\":\"2019\"}],\"renderers\":[{\"id\":\"2041\"}],\"title\":{\"id\":\"2124\"},\"toolbar\":{\"id\":\"2030\"},\"x_range\":{\"id\":\"2007\"},\"x_scale\":{\"id\":\"2011\"},\"y_range\":{\"id\":\"2009\"},\"y_scale\":{\"id\":\"2013\"}},\"id\":\"2006\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2128\",\"type\":\"AllLabels\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x_values\"},\"y\":{\"field\":\"y_values\"}},\"id\":\"2038\",\"type\":\"Circle\"},{\"attributes\":{\"source\":{\"id\":\"2005\"}},\"id\":\"2042\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2024\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"2028\",\"type\":\"HelpTool\"},{\"attributes\":{},\"id\":\"2026\",\"type\":\"SaveTool\"},{\"attributes\":{},\"id\":\"2132\",\"type\":\"UnionRenderers\"},{\"attributes\":{},\"id\":\"2131\",\"type\":\"AllLabels\"},{\"attributes\":{\"axis\":{\"id\":\"2019\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"2022\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2133\",\"type\":\"Selection\"},{\"attributes\":{\"tools\":[{\"id\":\"2023\"},{\"id\":\"2024\"},{\"id\":\"2025\"},{\"id\":\"2026\"},{\"id\":\"2027\"},{\"id\":\"2028\"}]},\"id\":\"2030\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"2016\",\"type\":\"BasicTicker\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"2124\",\"type\":\"Title\"},{\"attributes\":{\"axis\":{\"id\":\"2015\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"2018\",\"type\":\"Grid\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2005\"},\"glyph\":{\"id\":\"2038\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"2040\"},\"nonselection_glyph\":{\"id\":\"2039\"},\"view\":{\"id\":\"2042\"}},\"id\":\"2041\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"2127\"},\"group\":null,\"major_label_policy\":{\"id\":\"2128\"},\"ticker\":{\"id\":\"2020\"}},\"id\":\"2019\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2020\",\"type\":\"BasicTicker\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"2130\"},\"group\":null,\"major_label_policy\":{\"id\":\"2131\"},\"ticker\":{\"id\":\"2016\"}},\"id\":\"2015\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x_values\"},\"y\":{\"field\":\"y_values\"}},\"id\":\"2040\",\"type\":\"Circle\"},{\"attributes\":{\"data\":{\"x_values\":[1,2,3,4,5],\"y_values\":[6,7,2,3,6]},\"selected\":{\"id\":\"2133\"},\"selection_policy\":{\"id\":\"2132\"}},\"id\":\"2005\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2007\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2013\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2127\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"2029\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"2009\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"2023\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"2130\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"2011\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2027\",\"type\":\"ResetTool\"},{\"attributes\":{\"overlay\":{\"id\":\"2029\"}},\"id\":\"2025\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x_values\"},\"y\":{\"field\":\"y_values\"}},\"id\":\"2039\",\"type\":\"Circle\"}],\"root_ids\":[\"2006\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"9ca61b38-f2f2-420c-bf77-6d13ed7f9174\",\"root_ids\":[\"2006\"],\"roots\":{\"2006\":\"0aa634eb-d56e-4124-bc18-b5b749f1e1f0\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2006"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 首先，导入ColumnDataSource.\n",
    "from bokeh.plotting import figure\n",
    "from bokeh.models import ColumnDataSource\n",
    "\n",
    "# 创建一个字典：字典的键是列名（字符串）。dict 的值是数据列表或数组。create dict as basis for ColumnDataSource\n",
    "data = {'x_values': [1, 2, 3, 4, 5],\n",
    "        'y_values': [6, 7, 2, 3, 6]}\n",
    "\n",
    "# 使用你的ColumnDataSourceassource作为你的渲染器。create ColumnDataSource based on dict\n",
    "source = ColumnDataSource(data=data)\n",
    "\n",
    "# create a plot and renderer with ColumnDataSource data\n",
    "p = figure()\n",
    "p.circle(x='x_values', y='y_values', source=source, size=10)\n",
    "\n",
    "show(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c3d6d93",
   "metadata": {},
   "source": [
    "## 过滤数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "e739bf6e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "  <div class=\"bk-root\" id=\"17cdde99-b699-439e-855b-15c4f498f4c2\" data-root-id=\"2283\"></div>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "(function(root) {\n",
       "  function embed_document(root) {\n",
       "    \n",
       "  const docs_json = {\"a7a54ab8-6338-4f95-88d4-9288a2b17e18\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"children\":[{\"id\":\"2282\"},{\"id\":\"2280\"}]},\"id\":\"2283\",\"type\":\"Column\"},{\"attributes\":{},\"id\":\"2198\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"2232\",\"type\":\"LinearScale\"},{\"attributes\":{\"fill_color\":{\"value\":\"red\"},\"hatch_color\":{\"value\":\"red\"},\"line_color\":{\"value\":\"red\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2221\",\"type\":\"Circle\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"2268\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"2200\",\"type\":\"LinearScale\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"2274\"},\"group\":null,\"major_label_policy\":{\"id\":\"2275\"},\"ticker\":{\"id\":\"2235\"}},\"id\":\"2234\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2260\",\"type\":\"AllLabels\"},{\"attributes\":{\"tools\":[{\"id\":\"2210\"},{\"id\":\"2211\"},{\"id\":\"2212\"}]},\"id\":\"2214\",\"type\":\"Toolbar\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"2262\"},\"group\":null,\"major_label_policy\":{\"id\":\"2263\"},\"ticker\":{\"id\":\"2203\"}},\"id\":\"2202\",\"type\":\"LinearAxis\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2220\",\"type\":\"Circle\"},{\"attributes\":{\"axis\":{\"id\":\"2234\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"2237\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"2274\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"source\":{\"id\":\"2190\"}},\"id\":\"2224\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"2239\",\"type\":\"BasicTicker\"},{\"attributes\":{\"axis\":{\"id\":\"2202\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"2205\",\"type\":\"Grid\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2190\"},\"glyph\":{\"id\":\"2251\"},\"group\":null,\"hover_glyph\":{\"id\":\"2253\"},\"muted_glyph\":{\"id\":\"2254\"},\"nonselection_glyph\":{\"id\":\"2252\"},\"view\":{\"id\":\"2192\"}},\"id\":\"2255\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"2271\"},\"group\":null,\"major_label_policy\":{\"id\":\"2272\"},\"ticker\":{\"id\":\"2239\"}},\"id\":\"2238\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2264\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"coordinates\":null,\"group\":null},\"id\":\"2256\",\"type\":\"Title\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"2245\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"2207\",\"type\":\"BasicTicker\"},{\"attributes\":{\"coordinates\":null,\"formatter\":{\"id\":\"2259\"},\"group\":null,\"major_label_policy\":{\"id\":\"2260\"},\"ticker\":{\"id\":\"2207\"}},\"id\":\"2206\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"2265\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"2271\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"data\":{\"x\":[1,2,3,4,5],\"y\":[1,2,3,4,5]},\"selected\":{\"id\":\"2265\"},\"selection_policy\":{\"id\":\"2264\"}},\"id\":\"2190\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"2262\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2222\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"2275\",\"type\":\"AllLabels\"},{\"attributes\":{\"indices\":[0,2,4]},\"id\":\"2191\",\"type\":\"IndexFilter\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"2190\"},\"glyph\":{\"id\":\"2219\"},\"group\":null,\"hover_glyph\":{\"id\":\"2221\"},\"muted_glyph\":{\"id\":\"2222\"},\"nonselection_glyph\":{\"id\":\"2220\"},\"view\":{\"id\":\"2224\"}},\"id\":\"2223\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis\":{\"id\":\"2238\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"2241\",\"type\":\"Grid\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2219\",\"type\":\"Circle\"},{\"attributes\":{\"filters\":[{\"id\":\"2191\"}],\"source\":{\"id\":\"2190\"}},\"id\":\"2192\",\"type\":\"CDSView\"},{\"attributes\":{\"axis\":{\"id\":\"2206\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"2209\",\"type\":\"Grid\"},{\"attributes\":{\"below\":[{\"id\":\"2234\"}],\"center\":[{\"id\":\"2237\"},{\"id\":\"2241\"}],\"height\":300,\"left\":[{\"id\":\"2238\"}],\"renderers\":[{\"id\":\"2255\"}],\"title\":{\"id\":\"2268\"},\"toolbar\":{\"id\":\"2246\"},\"toolbar_location\":null,\"width\":300,\"x_range\":{\"id\":\"2226\"},\"x_scale\":{\"id\":\"2230\"},\"y_range\":{\"id\":\"2228\"},\"y_scale\":{\"id\":\"2232\"}},\"id\":\"2225\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"2272\",\"type\":\"AllLabels\"},{\"attributes\":{\"below\":[{\"id\":\"2202\"}],\"center\":[{\"id\":\"2205\"},{\"id\":\"2209\"}],\"height\":300,\"left\":[{\"id\":\"2206\"}],\"renderers\":[{\"id\":\"2223\"}],\"title\":{\"id\":\"2256\"},\"toolbar\":{\"id\":\"2214\"},\"toolbar_location\":null,\"width\":300,\"x_range\":{\"id\":\"2194\"},\"x_scale\":{\"id\":\"2198\"},\"y_range\":{\"id\":\"2196\"},\"y_scale\":{\"id\":\"2200\"}},\"id\":\"2193\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"overlay\":{\"id\":\"2245\"}},\"id\":\"2242\",\"type\":\"BoxSelectTool\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2251\",\"type\":\"Circle\"},{\"attributes\":{\"toolbar\":{\"id\":\"2281\"},\"toolbar_location\":\"above\"},\"id\":\"2282\",\"type\":\"ToolbarBox\"},{\"attributes\":{\"callback\":null},\"id\":\"2243\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"2196\",\"type\":\"DataRange1d\"},{\"attributes\":{\"overlay\":{\"id\":\"2213\"}},\"id\":\"2210\",\"type\":\"BoxSelectTool\"},{\"attributes\":{},\"id\":\"2259\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null},\"id\":\"2211\",\"type\":\"HoverTool\"},{\"attributes\":{},\"id\":\"2203\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2254\",\"type\":\"Circle\"},{\"attributes\":{\"toolbars\":[{\"id\":\"2214\"},{\"id\":\"2246\"}],\"tools\":[{\"id\":\"2210\"},{\"id\":\"2211\"},{\"id\":\"2212\"},{\"id\":\"2242\"},{\"id\":\"2243\"},{\"id\":\"2244\"}]},\"id\":\"2281\",\"type\":\"ProxyToolbar\"},{\"attributes\":{},\"id\":\"2228\",\"type\":\"DataRange1d\"},{\"attributes\":{\"children\":[[{\"id\":\"2193\"},0,0],[{\"id\":\"2225\"},0,1]]},\"id\":\"2280\",\"type\":\"GridBox\"},{\"attributes\":{},\"id\":\"2226\",\"type\":\"DataRange1d\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"2213\",\"type\":\"BoxAnnotation\"},{\"attributes\":{},\"id\":\"2244\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"2194\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_color\":{\"value\":\"red\"},\"hatch_color\":{\"value\":\"red\"},\"line_color\":{\"value\":\"red\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2253\",\"type\":\"Circle\"},{\"attributes\":{\"tools\":[{\"id\":\"2242\"},{\"id\":\"2243\"},{\"id\":\"2244\"}]},\"id\":\"2246\",\"type\":\"Toolbar\"},{\"attributes\":{},\"id\":\"2212\",\"type\":\"ResetTool\"},{\"attributes\":{},\"id\":\"2263\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"2235\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"size\":{\"value\":10},\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"2252\",\"type\":\"Circle\"},{\"attributes\":{},\"id\":\"2230\",\"type\":\"LinearScale\"}],\"root_ids\":[\"2283\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.2\"}};\n",
       "  const render_items = [{\"docid\":\"a7a54ab8-6338-4f95-88d4-9288a2b17e18\",\"root_ids\":[\"2283\"],\"roots\":{\"2283\":\"17cdde99-b699-439e-855b-15c4f498f4c2\"}}];\n",
       "  root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
       "\n",
       "  }\n",
       "  if (root.Bokeh !== undefined) {\n",
       "    embed_document(root);\n",
       "  } else {\n",
       "    let attempts = 0;\n",
       "    const timer = setInterval(function(root) {\n",
       "      if (root.Bokeh !== undefined) {\n",
       "        clearInterval(timer);\n",
       "        embed_document(root);\n",
       "      } else {\n",
       "        attempts++;\n",
       "        if (attempts > 100) {\n",
       "          clearInterval(timer);\n",
       "          console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n",
       "        }\n",
       "      }\n",
       "    }, 10, root)\n",
       "  }\n",
       "})(window);"
      ],
      "application/vnd.bokehjs_exec.v0+json": ""
     },
     "metadata": {
      "application/vnd.bokehjs_exec.v0+json": {
       "id": "2283"
      }
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 在 Bokeh 中，这些过滤后的子集称为“视图”.视图由 Bokeh 的CDSView类表示。\n",
    "from bokeh.layouts import gridplot\n",
    "from bokeh.models import CDSView, ColumnDataSource, IndexFilter\n",
    "from bokeh.plotting import figure, show\n",
    "\n",
    "# create ColumnDataSource from a dict\n",
    "source = ColumnDataSource(data=dict(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5]))\n",
    "\n",
    "# 一个CDSView对象有两个属性：source-ColumnDataSource您要应用过滤器的;filters-Filter对象列表\n",
    "# 将CDSView对象 传递给view渲染器的参数\n",
    "# create a view using an IndexFilter with the index positions [0, 2, 4]\n",
    "view = CDSView(source=source, filters=[IndexFilter([0, 2, 4])])\n",
    "\n",
    "# setup tools\n",
    "tools = [\"box_select\", \"hover\", \"reset\"]\n",
    "\n",
    "# create a first plot with all data in the ColumnDataSource\n",
    "p = figure(height=300, width=300, tools=tools)\n",
    "p.circle(x=\"x\", y=\"y\", size=10, hover_color=\"red\", source=source)\n",
    "\n",
    "# 使用了视图 create a second plot with a subset of ColumnDataSource, based on view\n",
    "p_filtered = figure(height=300, width=300, tools=tools)\n",
    "p_filtered.circle(x=\"x\", y=\"y\", size=10, hover_color=\"red\", source=source, view=view)\n",
    "\n",
    "# show both plots next to each other in a gridplot layout\n",
    "show(gridplot([[p, p_filtered]]))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ff3d3670",
   "metadata": {},
   "source": [
    "# 使用交互式小部件"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bdc31443",
   "metadata": {},
   "source": [
    "[使用小部件来显示附加信息或以交互方式控制 Bokeh 文档的元素](https://docs.bokeh.org/en/latest/docs/first_steps/first_steps_9.html)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
